<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%

String diseaseList= (String)request.getAttribute("diseaseList");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>${title }</title>
<link rel="stylesheet"
	href="${basePath}/static/bootstrap/css/bootstrap.css" />
<link href="${basePath}/static/css/basic.css" rel="stylesheet"
	type="text/css">
<link href="${basePath}/static/css/login.css" rel="stylesheet"
	type="text/css">
<link href="${basePath}/static/css1/lyh.css" rel="stylesheet"
	type="text/css">
<link href="${basePath}/static/css/list.css" rel="stylesheet"
	type="text/css">
<link rel="stylesheet" type="text/css"
	href="${basePath}/static/css1/index.css">
<link rel="stylesheet" type="text/css"
	href="${basePath}/static/assert/jquery-ui/jquery-ui.css">
<script type="text/javascript" src="${basePath}/static/js/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/assert/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript"
	src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript"
	src="${basePath}/static/page/jqPaginator/jqPaginator.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_defined.css" rel="stylesheet" type="text/css">

<style type="text/css">
.btn {
	padding: 6px;
}

.input_select {
	height: 28px;
	width: 57%;
}
</style>
</head>
<body class="bj">
	<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

	<!--内容部分-->
	<div class="list_main lay_out" class="clearfix">
		<div class="list_DH">
			<%@include file="/WEB-INF/templates/common/queryNav.jsp"%>
		</div>
		<div class="list_NR">
			<div class="loc">
				<h3 style="margin:0">特殊检索</h3>
			</div>
			<div class="list_con_table" style="margin-top:-10px">
				<div class="search_table">
					<ul>
						<li class="Label_1" style="width: 10%">姓名：&nbsp;</li>
						<li class="Label_2" style="width: 23%"><input
							class="input_box" type="text" name='' id='patientName' value='' /></li>
						<li class="Label_1">ID号：&nbsp;</li>
						<li class="Label_2"><input class="input_box" type="text"
							name='' id='mrId' value='' /></li>
						<li class="Label_1">身份证：&nbsp;</li>
						<li class="Label_2"><input class="input_box" type="text"
							name='' id='idNumber' value='' /></li>
						<li class="Label_1" style="width: 10%">出院日期：&nbsp;</li>
						<li class="Label_2" style="width: 23%">
						<input
							class="input_box" style="width: 44%" type="text"
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name=''
							id='outHospitalStartTime' value='' />&nbsp;-&nbsp;<input
							class="input_box" style="width: 44%" type="text"
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name=''
							id='outHospitalEndTime' value='' /></li>
						<li class="Label_1">出院科室：&nbsp;</li>
						<li class="Label_2 field">
						<select id="outHospitalOfficeName" style="width:95%;height: 28px; text-align: left;text-indent: 5px;line-height: 28px; background: #fff;border: #e3e5e4 solid 1px;">
								<option value=''>-------请选择-------</option> 
								<c:forEach items="${basicInfoList.outOfficeList}" var="outOffice">
									<option value='${outOffice.name}'>${outOffice.name}</option> 
								</c:forEach>
						</select>	
		
						
						<li class="Label_1">病案号：&nbsp;</li>
						<li class="Label_2"><input style="width: 94%; height: 28px" class="input_box" type="text"
							name='' id='onlyId' value='' /></li>
			
						
						
						</li>
						

						
						<li class="Label_5"><a onclick="init(1,10)">查询</a></li>
					</ul>
				</div>
				<table style="width: 100%; float: left; border-collapse: collapse;"
					cellpadding="0" cellspacing="0">
					<tr>
						<td class="tdLabel_4">ID号</td>
						<td class="tdLabel_4">姓名</td>
						<td class="tdLabel_4">身份证</td>
						<td class="tdLabel_4">出院科室</td>
						<td class="tdLabel_4">出院时间</td>
						<td class="tdLabel_4">住院次数</td>
						<td class="tdLabel_4">操作</td>
					</tr>
					<tr id="loading" style="height:50px;display:none">
	       				<td colspan="6" align="center" ><img src="${basePath}/static/layer/skin/default/loading-2.gif"></td>
				    </tr>
					<tbody id="tbody"></tbody>
				</table>
				
				<div class="pageList">
            <ul class="pagination clearfix" id="page_plus"></ul>
            <div class="pagination">
                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
            </div>
        </div>

			</div>
		</div>
	</div>	
		<!------页脚部分--------->
		<%@include file="/WEB-INF/templates/common/footer.jsp"%>

		<!--JS部分-->
		<script type="text/javascript">
			function init(pageNo, pageSize) {

				var patientName = $("#patientName").val();
				var onlyId = $("#onlyId").val();
				var mrId = $("#mrId").val();
				var idNumber = $("#idNumber").val();
				var outHospitalStartTime = $("#outHospitalStartTime").val();
				var outHospitalEndTime = $("#outHospitalEndTime").val();
			 	var outHospitalOfficeName = $("#outHospitalOfficeName").val();
		
			 	//alert(patientName+"--"+onlyId+"--"+mrId+"--"+idNumber+"--"+outHospitalStartTime+"--"+outHospitalEndTime+"--"+visitNumber+"--"+outHospitalTypeName+"--"+outHospitalOfficeName+"--"+inHospitalStateName+"--"+operationName+"--"+operationRadio+"--"+paymentTypeName+"--"+professionName+"--"+diseaseName+"--"+diseaseRadio+"--"+startAge+"--"+endAge+"=="+marraigeName);
			
				if((patientName=="" || patientName==null) && (onlyId=="" || onlyId==null) && (idNumber=="" || idNumber==null)&& (outHospitalStartTime=="" || outHospitalStartTime==null)&& (outHospitalEndTime=="" || outHospitalEndTime==null)&& (mrId=="" || mrId==null) 
					&& (outHospitalOfficeName=="" || outHospitalOfficeName==null) 
					 ){
					layer.alert("请至少输入一个查询条件!",{icon:5});
					return;
				}
			
				jQuery.support.cors = true;
				
					$.ajax({
							type : 'post',
							url : "${basePath}/retrieval/getMedicalSpecialRecord",
							data : {
								patientName : patientName,
								onlyId : onlyId,
								mrId : mrId,
								idNumber : idNumber,
								outHospitalStartTime : outHospitalStartTime,
								outHospitalEndTime : outHospitalEndTime,
								specialIndication:2,
								outHospitalOfficeName : outHospitalOfficeName,
								pageNo:pageNo,
								pageSize:pageSize
							},
							beforeSend:function(){
								$("#tbody").html("");
								$("#loading").show();
							},
							success : function(data) {
								$("#loading").hide();
		
								if (data.success) {
									var hospitalNotes = data.data.specialMedicalList;
									var totalCount = data.data.totalCount;
									var len = hospitalNotes.length;
									if (len > 0) {
										var html = '';
										for (var i = 0; i < len; i++) {
											var obj = hospitalNotes[i];
											html += "<tr>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.mrId == undefined ? ''
															: obj.mrId)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.NAME == undefined ? ''
															: obj.NAME)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.idNumber == undefined ? ''
															: obj.idNumber)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.officeName == undefined ? ''
															: obj.officeName)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.outHospitalDate == undefined ? ''
															: obj.outHospitalDate)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+ (obj.visitNumber == undefined ? ''
															: obj.visitNumber)
													+ "</td>"
													+ "  <td class='tdLabel_5'>"
													+" <a class='int' target='_blank' href='${corePath}/medical_record/print?visitGuid="
												    + obj.firstGuid
													+ "'>查看病案</a>"
													+"</td></tr>";

										}
										page(pageNo, totalCount)
										$("#tbody").html("").html(html);
									} else {
										layer.alert("数据为空!",{icon:5});
										$("#tbody").html("");
									}
								}
							}
						})
			}

			function page(currentPage, totalCounts) {
				var pageSize = 10;
				var visiblePages = 5;
				var totalPages = Math.ceil(totalCounts / pageSize);
				$('#page_plus')
						.jqPaginator(
								{

									totalCounts : totalCounts,
									pageSize : pageSize,
									visiblePages : visiblePages,
									currentPage : currentPage,

									first : '<li class="first"><a href="javascript:void(0);">首页</a></li>',
									prev : '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
									next : '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
									last : '<li class="last"><a href="javascript:void(0);">末页</a></li>',
									page : '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
									onPageChange : function(num, type) {

										if (type != 'init') {

											init(num, pageSize);
										}

										$("#totalPage").html(totalCounts);
										$("#currentPage").html(
												num + "/" + totalPages);
									}
								});

			}

		
		</script>
</body>
</html>
